import matplotlib.pyplot as plt

# 数据
companies = ['Yili', 'Bright Dairy']
total_revenue = [1262, 264.85]
growth_rate = [2.44, -6.13]
net_profit = [104.29, 9.67]
profit_growth_rate = [10.58, 168.19]
gross_margin = [32.58, 20]
net_margin = [8.18, 3.14]

# 创建一个2x3的子图布局
fig, axs = plt.subplots(2, 3, figsize=(18, 10))

# 绘制总营收对比图
axs[0, 0].bar(companies, total_revenue, color=['blue', 'green'])
axs[0, 0].set_title('Total Revenue Comparison')
axs[0, 0].set_ylabel('Revenue (Billion Yuan)')

# 绘制总营收同比增长率对比图
axs[0, 1].bar(companies, growth_rate, color=['red', 'orange'])
axs[0, 1].set_title('Revenue Growth Rate Comparison')
axs[0, 1].set_ylabel('Growth Rate (%)')

# 绘制归母净利润对比图
axs[0, 2].bar(companies, net_profit, color=['purple', 'pink'])
axs[0, 2].set_title('Net Profit Comparison')
axs[0, 2].set_ylabel('Net Profit (Billion Yuan)')

# 绘制归母净利润同比增长率对比图
axs[1, 0].bar(companies, profit_growth_rate, color=['brown', 'gray'])
axs[1, 0].set_title('Net Profit Growth Rate Comparison')
axs[1, 0].set_ylabel('Growth Rate (%)')

# 绘制毛利率对比图
axs[1, 1].bar(companies, gross_margin, color=['cyan', 'magenta'])
axs[1, 1].set_title('Gross Margin Comparison')
axs[1, 1].set_ylabel('Gross Margin (%)')

# 绘制净利率对比图
axs[1, 2].bar(companies, net_margin, color=['yellow', 'black'])
axs[1, 2].set_title('Net Margin Comparison')
axs[1, 2].set_ylabel('Net Margin (%)')

# 调整布局
plt.tight_layout()

# 显示图表
plt.show()